import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class Problem8 {

	public static void main(String[] args) throws IOException {
		FileReader fr = new FileReader(new File(
				"C:/oracle_java/MyProgect/bin/test.txt"));
		int counter = 1;
		int maxSum = 0;
		char[] cbuf = new char[1000];
		char temp = 0;
		int iteration = 0;
		fr.read(cbuf, 0, cbuf.length);
		for (int i = -1; i < cbuf.length; i++) {
			for (int j = i + 1; j < cbuf.length; j++) {
				if (iteration == 5) {
					if (maxSum > counter) {
					} else {
						maxSum = counter;
					}
					iteration = 0;
					counter = 1;
					break;
				} else
					temp = cbuf[j];
				counter = counter * (Character.getNumericValue(temp));
				iteration++;
			}
		}
		System.out.println(maxSum);
	}
}
